﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using OAPlatform.EFAccess;
using OAPlatform.DomainModel.Model;

namespace MvcWeb.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            List<User> userList = new List<OAPlatform.DomainModel.Model.User>();
            ViewBag.Message = "Welcome to ASP.NET MVC!";
            using (var db = new OAContext())
            {
                User user = new User { Name = "FormatD" };
                user.Band = new Band { Name = "项目经理", Department = new Department { Name = "开发部" } };
                db.Users.Add(user);
                db.SaveChanges();
                userList = db.Users.ToList();
            }

            return View(userList);
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
